package com.c4.dao;

import com.c4.domain.deviceStatus;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface deviceStatusDao {
    //设备分页显示
    List<deviceStatus> list();
    //根据id找设备
    @Select("select * from device_status where id = #{id}")
    deviceStatus detail(Integer id);
    //设备全部显示
    @Select("select * from device_status")
    List<deviceStatus> listAll();
    //添加设备
    @Insert("insert into device_status(name2,model,type,health,name,longitude,latitude,num,noise,utilize,interfere)\n" +
            "values\n" +
            "(#{name2},#{model},#{type},#{health},#{name},#{longitude},#{latitude},#{num},#{noise},#{utilize},#{interfere})")
    void add(deviceStatus deviceStatus);
    //删除设备
    @Delete("delete from device_status where id = #{id}")
    void delete(Integer id);
    //故障设备分页展示
    List<deviceStatus> listWarn();
    //正常设备显示
    @Select("select * from device_status where warn_statue = 0")
    List<deviceStatus> listAllNormal();
    //修改设备故障状态
    @Update("update device_status set warn_statue=1,warn_problem=#{warnProblem},warn_level=#{warnLevel},warn_time=#{warnTime} where name2=#{name2}")
    void warnUpdate(deviceStatus deviceStatus);
    //设备故障已解决分页显示
    List<deviceStatus> listStra();
    //故障设备处理策略
    @Update("update device_status set warn_statue=0,stra_statue=1,stra_way=#{straWay},stra_time=#{straTime} where name2=#{name2}")
    void straUpdate(deviceStatus deviceStatus);
}
